package cz.zcu.fav.rat.managed.bean.calendar.event;

import cz.zcu.fav.rat.beans.Period;
import cz.zcu.fav.rat.managed.bean.calendar.ReservationEvent;

public class ReservationEventFactory implements IEventFactory
{
	private static final long serialVersionUID = 8655061975646684175L;

	@Override
	public ReservationEvent getEvent(Period period)
	{
		ReservationEvent event = new ReservationEvent(period.getReservation()
				.getObject().getName(), period.getFromDate().toDate(),
				period.getToDate().toDate(), period.getReservation().getUser(),
				period.getReservation().getObject(), period.getReservation(),
				period);
		event.setPeriodical(period.getReservation().getPeriods().size() > 1);
		event.setEnabled(period.isValid());
		return event;
	}

}
